.class Lrexsee/security/RexseeEncryption$6;
.super Lrexsee/core/browser/clazz/SyncTask$BooleanRunnable;
.source "RexseeEncryption.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lrexsee/security/RexseeEncryption;->decryptWithRSA(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZZZ)Z
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lrexsee/security/RexseeEncryption;

.field private final synthetic val$isPublicKey:Z

.field private final synthetic val$key:Ljava/lang/String;

.field private final synthetic val$sourcePath:Ljava/lang/String;

.field private final synthetic val$targetPath:Ljava/lang/String;


# direct methods
.method constructor <init>(Lrexsee/security/RexseeEncryption;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)V
    .locals 0

    .prologue
    .line 1
    iput-object p1, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    iput-object p2, p0, Lrexsee/security/RexseeEncryption$6;->val$sourcePath:Ljava/lang/String;

    iput-object p3, p0, Lrexsee/security/RexseeEncryption$6;->val$targetPath:Ljava/lang/String;

    iput-boolean p4, p0, Lrexsee/security/RexseeEncryption$6;->val$isPublicKey:Z

    iput-object p5, p0, Lrexsee/security/RexseeEncryption$6;->val$key:Ljava/lang/String;

    .line 386
    invoke-direct {p0}, Lrexsee/core/browser/clazz/SyncTask$BooleanRunnable;-><init>()V

    return-void
.end method


# virtual methods
.method public run()Z
    .locals 13

    .prologue
    const/4 v12, 0x0

    const-string v9, "RSA"

    .line 390
    :try_start_0
    iget-object v9, p0, Lrexsee/security/RexseeEncryption$6;->val$sourcePath:Ljava/lang/String;

    invoke-static {v9}, Lrexsee/core/utilities/Utilities;->getContent(Ljava/lang/String;)[B

    move-result-object v3

    .line 391
    .local v3, "data":[B
    if-nez v3, :cond_0

    .line 392
    iget-object v9, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    # getter for: Lrexsee/security/RexseeEncryption;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v9}, Lrexsee/security/RexseeEncryption;->access$4(Lrexsee/security/RexseeEncryption;)Lrexsee/core/browser/Browser;

    move-result-object v9

    iget-object v10, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    invoke-virtual {v10}, Lrexsee/security/RexseeEncryption;->getInterfaceName()Ljava/lang/String;

    move-result-object v10

    const-string v11, "Error on reading source file."

    invoke-virtual {v9, v10, v11}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    move v9, v12

    .line 413
    .end local v3    # "data":[B
    :goto_0
    return v9

    .line 395
    .restart local v3    # "data":[B
    :cond_0
    iget-object v9, p0, Lrexsee/security/RexseeEncryption$6;->val$targetPath:Ljava/lang/String;

    invoke-static {v9}, Lrexsee/core/utilities/Utilities;->prepareWriteFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v6

    .line 396
    .local v6, "targetFile":Ljava/io/File;
    if-nez v6, :cond_1

    .line 397
    iget-object v9, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    # getter for: Lrexsee/security/RexseeEncryption;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v9}, Lrexsee/security/RexseeEncryption;->access$4(Lrexsee/security/RexseeEncryption;)Lrexsee/core/browser/Browser;

    move-result-object v9

    iget-object v10, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    invoke-virtual {v10}, Lrexsee/security/RexseeEncryption;->getInterfaceName()Ljava/lang/String;

    move-result-object v10

    const-string v11, "Error on prepare target file."

    invoke-virtual {v9, v10, v11}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/String;)V

    move v9, v12

    .line 398
    goto :goto_0

    .line 400
    :cond_1
    new-instance v1, Ljava/io/BufferedOutputStream;

    new-instance v9, Ljava/io/FileOutputStream;

    invoke-direct {v9, v6}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V

    invoke-direct {v1, v9}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V

    .line 401
    .local v1, "bos":Ljava/io/BufferedOutputStream;
    iget-boolean v9, p0, Lrexsee/security/RexseeEncryption$6;->val$isPublicKey:Z

    if-eqz v9, :cond_2

    const-string v9, "RSA"

    iget-object v10, p0, Lrexsee/security/RexseeEncryption$6;->val$key:Ljava/lang/String;

    # invokes: Lrexsee/security/RexseeEncryption;->string2publicKey_(Ljava/lang/String;Ljava/lang/String;)Ljava/security/PublicKey;
    invoke-static {v9, v10}, Lrexsee/security/RexseeEncryption;->access$5(Ljava/lang/String;Ljava/lang/String;)Ljava/security/PublicKey;

    move-result-object v9

    move-object v8, v9

    .line 402
    .local v8, "theKey":Ljava/security/Key;
    :goto_1
    const-string v9, "RSA"

    invoke-static {v9}, Ljavax/crypto/Cipher;->getInstance(Ljava/lang/String;)Ljavax/crypto/Cipher;

    move-result-object v2

    .line 403
    .local v2, "cipher":Ljavax/crypto/Cipher;
    const/4 v9, 0x2

    invoke-virtual {v2, v9, v8}, Ljavax/crypto/Cipher;->init(ILjava/security/Key;)V

    .line 404
    invoke-virtual {v2}, Ljavax/crypto/Cipher;->getBlockSize()I

    move-result v0

    .line 405
    .local v0, "blockSize":I
    invoke-static {v3, v0}, Lrexsee/security/RexseeSecurity;->bytesSplit([BI)[[B

    move-result-object v7

    .line 406
    .local v7, "temp":[[B
    const/4 v5, 0x0

    .local v5, "i":I
    :goto_2
    array-length v9, v7

    if-lt v5, v9, :cond_3

    .line 409
    invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V

    .line 410
    const/4 v9, 0x1

    goto :goto_0

    .line 401
    .end local v0    # "blockSize":I
    .end local v2    # "cipher":Ljavax/crypto/Cipher;
    .end local v5    # "i":I
    .end local v7    # "temp":[[B
    .end local v8    # "theKey":Ljava/security/Key;
    :cond_2
    const-string v9, "RSA"

    iget-object v10, p0, Lrexsee/security/RexseeEncryption$6;->val$key:Ljava/lang/String;

    # invokes: Lrexsee/security/RexseeEncryption;->string2privateKey_(Ljava/lang/String;Ljava/lang/String;)Ljava/security/PrivateKey;
    invoke-static {v9, v10}, Lrexsee/security/RexseeEncryption;->access$6(Ljava/lang/String;Ljava/lang/String;)Ljava/security/PrivateKey;

    move-result-object v9

    move-object v8, v9

    goto :goto_1

    .line 407
    .restart local v0    # "blockSize":I
    .restart local v2    # "cipher":Ljavax/crypto/Cipher;
    .restart local v5    # "i":I
    .restart local v7    # "temp":[[B
    .restart local v8    # "theKey":Ljava/security/Key;
    :cond_3
    aget-object v9, v7, v5

    invoke-virtual {v2, v9}, Ljavax/crypto/Cipher;->doFinal([B)[B

    move-result-object v9

    invoke-virtual {v1, v9}, Ljava/io/BufferedOutputStream;->write([B)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 406
    add-int/lit8 v5, v5, 0x1

    goto :goto_2

    .line 411
    .end local v0    # "blockSize":I
    .end local v1    # "bos":Ljava/io/BufferedOutputStream;
    .end local v2    # "cipher":Ljavax/crypto/Cipher;
    .end local v3    # "data":[B
    .end local v5    # "i":I
    .end local v6    # "targetFile":Ljava/io/File;
    .end local v7    # "temp":[[B
    .end local v8    # "theKey":Ljava/security/Key;
    :catch_0
    move-exception v9

    move-object v4, v9

    .line 412
    .local v4, "e":Ljava/lang/Exception;
    iget-object v9, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    # getter for: Lrexsee/security/RexseeEncryption;->mBrowser:Lrexsee/core/browser/Browser;
    invoke-static {v9}, Lrexsee/security/RexseeEncryption;->access$4(Lrexsee/security/RexseeEncryption;)Lrexsee/core/browser/Browser;

    move-result-object v9

    iget-object v10, p0, Lrexsee/security/RexseeEncryption$6;->this$0:Lrexsee/security/RexseeEncryption;

    invoke-virtual {v10}, Lrexsee/security/RexseeEncryption;->getInterfaceName()Ljava/lang/String;

    move-result-object v10

    invoke-virtual {v9, v10, v4}, Lrexsee/core/browser/Browser;->exception(Ljava/lang/String;Ljava/lang/Exception;)V

    move v9, v12

    .line 413
    goto :goto_0
.end method
